home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / TeX-inputs / LaTeX / base / docstrip.tex < prev    next >
Text File  |  1997-03-07  |  34KB  |  1,108 lines

  1. %%
  2. %% This is file `docstrip.tex',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% docstrip.dtx  (with options: `initex,program,stats')
  8. %% 
  9. %% This is a generated file.
  10. %% 
  11. %% Copyright 1993 1994 1995 1996 1997
  12. %% The LaTeX3 Project and any individual authors listed elsewhere
  13. %% in this file.
  14. %% 
  15. %% For further copyright information, and conditions for modification
  16. %% and distribution, see the file legal.txt, and any other copyright
  17. %% notices in this file.
  18. %% 
  19. %% This file is part of the LaTeX2e system.
  20. %% ----------------------------------------
  21. %%   This system is distributed in the hope that it will be useful,
  22. %%   but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. %%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. %% 
  25. %%   For error reports concerning UNCHANGED versions of this file no
  26. %%   more than one year old, see bugs.txt.
  27. %% 
  28. %%   Please do not request updates from us directly.  Primary
  29. %%   distribution is through the CTAN archives.
  30. %% 
  31. %% 
  32. %% IMPORTANT COPYRIGHT NOTICE:
  33. %% 
  34. %% You are NOT ALLOWED to distribute this file alone.
  35. %% 
  36. %% You are allowed to distribute this file under the condition that it
  37. %% is distributed together with all the files listed in manifest.txt.
  38. %% 
  39. %% If you receive only some of these files from someone, complain!
  40. %% 
  41. %% 
  42. %% Permission is granted to copy this file to another file with a
  43. %% clearly different name and to customize the declarations in that
  44. %% copy to serve the needs of your installation, provided that you
  45. %% comply with the conditions in the file legal.txt.
  46. %% 
  47. %% However, NO PERMISSION is granted to generate or to distribute a
  48. %% modified version of this file under its original name.
  49. %% 
  50. %% You are NOT ALLOWED to change this file.
  51. %% 
  52. %% 
  53. %% MODIFICATION ADVICE:
  54. %% 
  55. %% If you want to customize this file, it is best to make a copy of
  56. %% the source file(s) from which it was produced.  Use a different
  57. %% name for your copy(ies) and modify the copy(ies); this will ensure
  58. %% that your modifications do not get overwritten when you install a
  59. %% new release of the standard system.  You should also ensure that
  60. %% your modified source file does not generate any modified file with
  61. %% the same name as a standard file.
  62. %% 
  63. %% You can then easily distribute your modifications by distributing
  64. %% the modified and renamed copy of the source file, taking care to
  65. %% observe the conditions in legal.txt; this will ensure that other
  66. %% users can safely use your modifications.
  67. %% 
  68. %% You will also need to produce your own, suitably named, .ins file to
  69. %% control the generation of files from your source file; this file
  70. %% should contain your own preambles for the files it generates, not
  71. %% those in the standard .ins files.
  72. %% 
  73. %% The names of the source files used are shown above.
  74. %% 
  75. %% 
  76. %% 
  77. \catcode`\{=1
  78. \catcode`\}=2
  79. \def\filename{docstrip.dtx}
  80. \def\fileversion{2.4g}
  81. \def\filedate{1996/12/13}
  82. \def\docdate {1996/12/13}
  83. %% \CharacterTable
  84. %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
  85. %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
  86. %%   Digits        \0\1\2\3\4\5\6\7\8\9
  87. %%   Exclamation   \!     Double quote  \"     Hash (number) \#
  88. %%   Dollar        \$     Percent       \%     Ampersand     \&
  89. %%   Acute accent  \'     Left paren    \(     Right paren   \)
  90. %%   Asterisk      \*     Plus          \+     Comma         \,
  91. %%   Minus         \-     Point         \.     Solidus       \/
  92. %%   Colon         \:     Semicolon     \;     Less than     \<
  93. %%   Equals        \=     Greater than  \>     Question mark \?
  94. %%   Commercial at \@     Left bracket  \[     Backslash     \\
  95. %%   Right bracket \]     Circumflex    \^     Underscore    \_
  96. %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
  97. %%   Right brace   \}     Tilde         \~}
  98. %%
  99. %% The docstrip program for use with TeX.
  100. %% Copyright (C) 1989-1991 Frank Mittelbach
  101. %% Copyright (C) 1992-1995 Johannes Braams, Denys Duchier,
  102. %%                         Frank Mittelbach
  103. %% Copyright (C) 1995 Marcin Woli\'nski
  104. %% Copyright (C) 1996 Mark Wooding, Marcin Woli\'nski
  105. %% All rights are reserved.
  106. %%
  107. \catcode`\Z=\catcode`\%
  108. \ifnum13=\catcode`\~{\egroup\else
  109.   \catcode`\Z=9
  110. Z
  111. Z  \catcode`\{=1  \catcode`\}=2
  112. Z  \catcode`\#=6  \catcode`\^=7
  113. Z  \catcode`\@=11 \catcode`\^^L=13
  114. Z  \let\bgroup={  \let\egroup=}
  115. Z
  116. Z  \dimendef\z@=10 \z@=0pt \chardef\@ne=1 \countdef\m@ne=22 \m@ne=-1
  117. Z  \countdef\count@=255
  118. Z
  119. Z  \def\wlog{\immediate\write\m@ne} \def\space{ }
  120. Z
  121. Z  \count10=22 % allocates \count registers 23, 24, ...
  122. Z  \count15=9 % allocates \toks registers 10, 11, ...
  123. Z  \count16=-1 % allocates input streams 0, 1, ...
  124. Z  \count17=-1 % allocates output streams 0, 1, ...
  125. Z
  126. Z  \def\alloc@#1#2#3{\advance\count1#1\@ne#2#3\count1#1\relax}
  127. Z
  128. Z  \def\newcount{\alloc@0\countdef} \def\newtoks{\alloc@5\toksdef}
  129. Z  \def\newread{\alloc@6\chardef}   \def\newwrite{\alloc@7\chardef}
  130. Z
  131. Z \def\newif#1{%
  132. Z   \count@\escapechar \escapechar\m@ne
  133. Z     \let#1\iffalse
  134. Z     \@if#1\iftrue
  135. Z     \@if#1\iffalse
  136. Z   \escapechar\count@}
  137. Z \def\@if#1#2{%
  138. Z   \expandafter\def\csname\expandafter\@gobbletwo\string#1%
  139. Z                     \expandafter\@gobbletwo\string#2\endcsname
  140. Z                        {\let#1#2}}
  141. Z
  142. Z  \def\@gobbletwo#1#2{}
  143. Z  \def\@gobblethree#1#2#3{}
  144. Z
  145. Z  \def\loop#1\repeat{\def\body{#1}\iterate}
  146. Z  \def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next}
  147. Z  \let\repeat\fi
  148. Z
  149. Z  \def\empty{}
  150. Z
  151. Z  \def\tracingall{\tracingcommands2 \tracingstats2
  152. Z    \tracingpages1 \tracingoutput1 \tracinglostchars1
  153. Z    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  154. Z    \showboxbreadth 10000 \showboxdepth 10000 \errorstopmode
  155. Z    \errorcontextlines 10000 \tracingonline1 }
  156. Z
  157. \bgroup}\fi\catcode`\Z=11
  158. \let\bgroup={  \let\egroup=}
  159. \catcode`\@=11
  160. \newlinechar=`\^^J
  161. \newif\ifGenerate
  162. \newif\ifContinue
  163. \newif\ifForlist
  164. \newif\ifDefault
  165. \newif\ifMoreFiles \MoreFilestrue
  166. \newif\ifaskforoverwrite \askforoverwritetrue
  167. \newcount\blockLevel \blockLevel\z@
  168. \newcount\emptyLines \emptyLines \z@
  169. \newcount\processedLines   \processedLines  \z@
  170. \newcount\commentsRemoved  \commentsRemoved \z@
  171. \newcount\commentsPassed   \commentsPassed  \z@
  172. \newcount\codeLinesPassed  \codeLinesPassed \z@
  173. \newcount\NumberOfFiles \NumberOfFiles\z@
  174. \newcount\TotalprocessedLines   \TotalprocessedLines  \z@
  175. \newcount\TotalcommentsRemoved  \TotalcommentsRemoved \z@
  176. \newcount\TotalcommentsPassed   \TotalcommentsPassed  \z@
  177. \newcount\TotalcodeLinesPassed  \TotalcodeLinesPassed \z@
  178. \newread\inFile
  179. \chardef\ttyin16
  180. \chardef\ttyout16
  181. \newread\inputcheck
  182. \newif\iftopbatchfile \topbatchfiletrue
  183. \def\ifToplevel{\relax\iftopbatchfile
  184.    \expandafter\iden \else \expandafter\@gobble\fi}
  185. \ifx\undefined\@@input \let\@@input\input\fi
  186. \def\batchinput#1{%
  187.    \begingroup
  188.      \def\batchfile{#1}%
  189.      \topbatchfilefalse
  190.      \Defaultfalse
  191.      \usepreamble\org@preamble
  192.      \usepostamble\org@postamble
  193.      \let\destdir\WriteToDir
  194.      \processbatchFile
  195.    \endgroup
  196. }
  197. \def\skip@input#1 {}
  198. \let\input\skip@input
  199. \def\guardStack{}
  200. \def\blockHead{}
  201. \def\yes{yes}
  202. \def\y{y}
  203. \def\n{n}
  204. \def\DefaultbatchFile{docstrip.cmd}
  205. {\catcode`\%=12
  206.  \gdef\perCent{%}
  207.  \gdef\DoubleperCent{%%}
  208. }
  209. \let\MetaPrefix\DoubleperCent
  210. \def^^L{ }
  211. \def\Name#1#2{\expandafter#1\csname#2\endcsname}
  212. \def\@stripstring{\expandafter\@gobble\string}
  213. \def\eltStart{}
  214. \def\eltEnd{}
  215. \def\qStop{\qStop}
  216. \def\pop#1#2{%
  217.   \ifx#1\empty
  218.     \Msg{Warning: Found end guard without matching begin}%
  219.     \let#2\empty
  220.   \else
  221.     \def\tmp{\expandafter\popX #1\qStop #1#2}%
  222.     \expandafter\tmp\fi}
  223. \def\popX\eltStart #1\eltEnd #2\qStop #3#4{\def#3{#2}\def#4{#1}}
  224. \def\push#1#2{\expandafter\pushX #1\qStop #1{\eltStart #2\eltEnd}}
  225. \def\pushX #1\qStop #2#3{\def #2{#3#1}}
  226. \def\forlist#1:=#2\do#3\od{%
  227.     \edef\ListCondition{#2}%
  228.     \Forlisttrue
  229.     \loop
  230.       \edef#1{\expandafter\FirstElt\ListCondition,\empty.}%
  231.       \edef\ListCondition{\expandafter\OtherElts\ListCondition,\empty.}%
  232.       \ifx#1\empty \Forlistfalse \else#3\fi
  233.       \ifForlist
  234.     \repeat}
  235. \def\FirstElt#1,#2.{#1}
  236. \def\OtherElts#1,#2.{#2}
  237. \def\whileswitch#1\fi#2{#1\loop#2#1\repeat\fi}
  238. \ifx\@tempcnta\undefined \newcount\@tempcnta \fi
  239. \@tempcnta=0
  240. \loop
  241. \Name\chardef{s@\number\@tempcnta}=0
  242. \csname newcount\expandafter\endcsname%
  243.   \csname off@\number\@tempcnta\endcsname
  244. \advance\@tempcnta1
  245. \ifnum\@tempcnta<16\repeat
  246. \let\s@do\relax
  247. \edef\@outputstreams{%
  248.   \s@do\Name\noexpand{s@0}\s@do\Name\noexpand{s@1}%
  249.   \s@do\Name\noexpand{s@2}\s@do\Name\noexpand{s@3}%
  250.   \s@do\Name\noexpand{s@4}\s@do\Name\noexpand{s@5}%
  251.   \s@do\Name\noexpand{s@6}\s@do\Name\noexpand{s@7}%
  252.   \s@do\Name\noexpand{s@8}\s@do\Name\noexpand{s@9}%
  253.   \s@do\Name\noexpand{s@10}\s@do\Name\noexpand{s@11}%
  254.   \s@do\Name\noexpand{s@12}\s@do\Name\noexpand{s@13}%
  255.   \s@do\Name\noexpand{s@14}\s@do\Name\noexpand{s@15}%
  256.   \noexpand\@nostreamerror
  257.   }
  258. \def\@nostreamerror{\errmessage{No more output streams!}}
  259. \def\@streamfound#1\@nostreamerror{\fi}
  260. \bgroup\edef\x{\egroup
  261.  \def\noexpand\@stripstr\string\s@{}}
  262. \x
  263. \chardef\stream@closed=16
  264. \def\StreamOpen#1{%
  265.   \chardef#1=\stream@closed
  266.   \def\s@do##1{\ifnum##1=0
  267.     \chardef#1=\expandafter\@stripstr\string##1 %
  268.     \global\chardef##1=1 %
  269.     \immediate\openout#1=\csname pth@\@stripstring#1\endcsname %
  270.     \@streamfound
  271.     \fi}
  272.   \@outputstreams
  273.   }
  274. \def\StreamClose#1{%
  275.   \immediate\closeout#1%
  276.   \def\s@do##1{\ifnum#1=\expandafter\@stripstr\string##1 %
  277.     \global\chardef##1=0 %
  278.     \@streamfound
  279.     \fi}
  280.   \@outputstreams
  281.   \chardef#1=\stream@closed
  282.   }
  283. \def\StreamPut{\immediate\write}
  284. \def\showprogress{\let\maybeMsg\message}
  285. \def\keepsilent{\let\maybeMsg\@gobble}
  286. \showprogress
  287. \def\Msg{\immediate\write\ttyout}
  288. \def\iden#1{#1}
  289. \def\strip#1#2 \@gobble{\def #1{#2}}
  290. \def\@defpar{\par}
  291. \def\Ask#1#2{%
  292.     \message{#2}\read\ttyin to #1\ifx#1\@defpar\def#1{}\else
  293.     \iden{\expandafter\strip
  294.        \expandafter#1#1\@gobble\@gobble} \@gobble\fi}
  295. \let\OriginalAsk=\Ask
  296. \def\askonceonly{%
  297.   \def\Ask##1##2{%
  298.     \OriginalAsk{##1}{##2}%
  299.     \global\let\Ask\OriginalAsk
  300.     \Ask\noprompt{%
  301.       By default you will be asked this question for every file.^^J%
  302.       If you enter `y' now,^^J%
  303.       I will asssume `y' for all future questions^^J%
  304.       without prompting.}%
  305.     \ifx\y\noprompt\let\noprompt\yes\fi
  306.     \ifx\yes\noprompt\gdef\Ask####1####2{\def####1{y}}\fi}}
  307. \def\@gobble#1{}
  308. \edef\Endinput{\expandafter\@gobble\string\\endinput}
  309. \def\makeOther#1{\catcode`#1=12\relax}
  310. \ifx\undefined\@@end\else\let\end\@@end\fi
  311. \ifx\@temptokena\undefined \csname newtoks\endcsname\@temptokena\fi
  312. \def\@addto#1#2{%
  313.   \@temptokena\expandafter{#1}%
  314.   \edef#1{\the\@temptokena#2}}
  315. \def\@ifpresent#1#2#3#4{%
  316.   \def\tmp##1#1##2\qStop{\ifx!##2!}%
  317.   \expandafter\tmp#2#1\qStop #4\else #3\fi
  318.   }
  319. \def\tospaces#1{%
  320.   \ifx#1\secapsot\secapsot\fi\space\tospaces}
  321. \def\secapsot\fi\space\tospaces{\fi}
  322. \def\@spaces{\space\space\space\space\space}
  323. \def\uptospace#1 #2\qStop{#1}
  324. \def\afterfi#1#2\fi{\fi#1}
  325. \def\@ifnextchar#1#2#3{\bgroup
  326.   \def\reserved@a{\ifx\reserved@c #1 \aftergroup\@firstoftwo
  327.     \else \aftergroup\@secondoftwo\fi\egroup
  328.     {#2}{#3}}%
  329.   \futurelet\reserved@c\@ifnch
  330.   }
  331. \def\@ifnch{\ifx \reserved@c \@sptoken \expandafter\@xifnch
  332.       \else \expandafter\reserved@a
  333.       \fi}
  334. \def\@firstoftwo#1#2{#1}
  335. \def\@secondoftwo#1#2{#2}
  336. \iden{\let\@sptoken= } %
  337. \iden{\def\@xifnch} {\futurelet\reserved@c\@ifnch}
  338. \def\Terminal#1#2#3{%
  339.   \expandafter\ifx\csname eT@#3\endcsname\relax
  340.     \afterfi{\Terminal{#1}{#2#3}}\else
  341.     \afterfi{\TerminalX{#1}{#2}#3}\fi
  342.   }
  343. \Name\let{eT@>}=1
  344. \Name\let{eT@&}=1 \Name\let{eT@!}=1
  345. \Name\let{eT@|}=1 \Name\let{eT@,}=1
  346. \Name\let{eT@(}=1 \Name\let{eT@)}=1
  347. \def\TerminalX#1#2{%
  348.   \ifx>#2> \errmessage{Error in expression: empty terminal}\fi
  349.   \Name\def{t@#2}##1,#2,##2\qStop{\ifx>##2>0\else1\fi}%
  350.   #1{\Name\noexpand{t@#2},##1,#2,\noexpand\qStop}%
  351.   }
  352. \def\Primary#1#2{%
  353.   \ifcase \ifx!#20\else\ifx(#21\else2\fi\fi\space
  354.   \afterfi{\Primary{\NPrimary{#1}}}\or
  355.   \afterfi{\Expression{\PExpression{#1}}}\or
  356.   \afterfi{\Terminal{#1}{}#2}\fi
  357.   }
  358. \def\NPrimary#1#2{%
  359.   #1{\noexpand\if1#20\noexpand\else1\noexpand\fi}%
  360.   }
  361. \def\PExpression#1#2#3{%
  362.   \ifx)#3\else
  363.     \errmessage{Error in expression: expected right parenthesis}\fi
  364.   #1{#2}}
  365. \def\Secondary#1{%
  366.   \Primary{\SecondaryX{#1}}}
  367. \bgroup\catcode`\&=12
  368. \gdef\SecondaryX#1#2#3{%
  369.   \ifx%
  370.   \afterfi{\Secondary{\SecondaryXX{#1}{#2}}}\else
  371.   \afterfi{#1{#2}#3}\fi
  372.   }
  373. \egroup
  374. \def\SecondaryXX#1#2#3{%
  375.   #1{\noexpand\if0#20\noexpand\else#3\noexpand\fi}}
  376. \def\Expression#1{%
  377.   \Secondary{\ExpressionX{#1}}}
  378. \def\ExpressionX#1#2#3{%
  379.   \if0\ifx|#31\else\ifx,#31\fi\fi0
  380.   \afterfi{#1{#2}#3}\else
  381.   \afterfi{\Expression{\ExpressionXX{#1}{#2}}}\fi
  382.   }
  383. \def\ExpressionXX#1#2#3{%
  384.   #1{\noexpand\if1#21\noexpand\else#3\noexpand\fi}}
  385. \def\StopParse#1#2{%
  386.   \ifx>#2 \else\errmessage{Error in expression: spurious #2}\fi
  387.   \edef\Expr##1{#1}}
  388. \def\Evaluate#1{%
  389.   \Expression\StopParse#1>}
  390. \def\normalLine#1\endLine{%
  391.   \advance\codeLinesPassed\@ne
  392.   \maybeMsg{.}%
  393.   \def\inLine{#1}%
  394.   \let\do\putline@do
  395.   \activefiles
  396.   }
  397. \def\putline@do#1#2#3{%
  398.   \StreamPut#1{\inLine}}
  399. \def\removeComment#1\endLine{%
  400.     \advance\commentsRemoved\@ne
  401.     \maybeMsg{\perCent}}
  402. \bgroup\catcode`\%=12
  403. \iden{\egroup
  404. \def\putMetaComment%}#1\endLine{%
  405.   \advance\commentsPassed\@ne
  406.   \edef\inLine{\MetaPrefix#1}%
  407.   \let\do\putline@do
  408.   \activefiles
  409.   }
  410. \begingroup
  411. \catcode`\%=12 \catcode`\*=14
  412. \gdef\processLine#1{*
  413.   \advance\processedLines\@ne
  414.   \ifx%#1
  415.     \expandafter\processLineX
  416.   \else
  417.     \expandafter\normalLine
  418.   \fi
  419.   #1}
  420. \endgroup
  421. \begingroup
  422. \catcode`\%=12 \catcode`\*=14
  423. \gdef\processLineX%#1{*
  424.   \ifcase\ifx%#10\else
  425.          \ifx<#11\else 2\fi\fi\relax
  426.     \expandafter\putMetaComment\or
  427.     \expandafter\checkOption\or
  428.     \expandafter\removeComment\fi
  429.   #1}
  430. \endgroup
  431. \def\checkOption<#1{%
  432.   \ifcase
  433.     \ifx*#10\else \ifx/#11\else
  434.     \ifx+#12\else \ifx-#13\else
  435.     \ifx<#14\else 5\fi\fi\fi\fi\fi\relax
  436.   \expandafter\starOption\or
  437.   \expandafter\slashOption\or
  438.   \expandafter\plusOption\or
  439.   \expandafter\minusOption\or
  440.   \expandafter\verbOption\or
  441.   \expandafter\doOption\fi
  442.   #1}
  443. \def\doOption#1>#2\endLine{%
  444.   \maybeMsg{<#1 . >}%
  445.   \Evaluate{#1}%
  446.   \def\do##1##2##3{%
  447.     \if1\Expr{##2}\StreamPut##1{#2}\fi
  448.     }%
  449.   \activefiles
  450.   }
  451. \def\plusOption+#1>#2\endLine{%
  452.   \maybeMsg{<+#1 . >}%
  453.   \Evaluate{#1}%
  454.   \def\do##1##2##3{%
  455.     \if1\Expr{##2}\StreamPut##1{#2}\fi
  456.     }%
  457.   \activefiles
  458.   }
  459. \def\minusOption-#1>#2\endLine{%
  460.   \maybeMsg{<-#1 . >}%
  461.   \Evaluate{#1}%
  462.   \def\do##1##2##3{%
  463.     \if1\Expr{##2}\else \StreamPut##1{#2}\fi
  464.     }%
  465.   \activefiles
  466.   }
  467. \def\starOption*#1>#2\endLine{%
  468.   \maybeMsg{<*#1}%
  469.   \expandafter\push\expandafter\guardStack\expandafter{\blockHead}%
  470.   \advance\blockLevel\@ne
  471.   \def\blockHead{#1}%
  472.   \Evaluate{#1}%
  473.   \let\do\checkguard@do
  474.   \outputfiles
  475.   \let\do\findactive@do
  476.   \edef\activefiles{\activefiles}
  477.   }
  478. \def\checkguard@do#1#2#3{%
  479.   \ifnum#3>0
  480.     \advance#3\@ne
  481.   \else
  482.     \if1\Expr{#2}\else
  483.       \advance#3\@ne\fi
  484.   \fi}
  485. \def\findactive@do#1#2#3{%
  486.   \ifnum#3=0
  487.     \noexpand\do#1{#2}#3\fi}
  488. \def\slashOption/#1>#2\endLine{%
  489.   \def\tmp{#1}%
  490.   \ifnum\blockLevel<\@ne
  491.     \errmessage{Spurious end block </\tmp> ignored}%
  492.   \else
  493.     \ifx\tmp\blockHead
  494.       \pop\guardStack\blockHead
  495.     \else
  496.       \errmessage{Found </\tmp> instead of </\blockHead>}%
  497.     \fi
  498.     \maybeMsg{>}%
  499.     \advance\blockLevel\m@ne
  500.   \let\do\closeguard@do
  501.   \outputfiles
  502.   \let\do\findactive@do
  503.   \edef\activefiles{\outputfiles}
  504.   \fi
  505.   }
  506. \def\closeguard@do#1#2#3{%
  507.   \ifnum#3>0
  508.     \advance#3\m@ne
  509.   \fi}
  510. \def\verbOption<#1\endLine{{%
  511.   \edef\verbStop{\perCent#1}\maybeMsg{<<<}%
  512.   \let\do\putline@do
  513.   \loop
  514.     \ifeof\inFile\errmessage{Source file ended while in verbatim
  515.                              mode!}\fi
  516.     \read\inFile to \inLine
  517.   \if 1\ifx\inLine\verbStop 0\fi 1% if not inLine==verbStop
  518.     \activefiles
  519.     \maybeMsg{.}%
  520.   \repeat
  521.   \maybeMsg{>}%
  522.   }}
  523. \def\generate#1{\begingroup
  524.   \let\inputfiles\empty \let\filestogenerate\empty
  525.   \let\file\@file
  526.   #1
  527.   \ifx\filestogenerate\empty\else
  528.   \Msg{^^JGenerating file(s) \filestogenerate}\fi
  529.   \def\inFileName{\csname in@\outFileName\endcsname}%
  530.   \def\ReferenceLines{\csname ref@\outFileName\endcsname}%
  531.   \processinputfiles
  532.   \endgroup}
  533. \def\processinputfiles{%
  534.   \let\newinputfiles\empty
  535.   \inputfiles
  536.   \let\inputfiles\newinputfiles
  537.   \ifx\inputfiles\empty\else
  538.     \expandafter\processinputfiles
  539.   \fi
  540.   }
  541. \def\file#1#2{\errmessage{Command `\string\file' only allowed in
  542.                           argument to `\string\generate'}}
  543. \def\@file#1{%
  544.   \Generatetrue
  545.   \makepathname{#1}%
  546.   \ifaskforoverwrite
  547.     \immediate\openin\inFile\@pathname\relax
  548.     \ifeof\inFile\else
  549.       \Ask\answer{File \@pathname\space already exists
  550.                   \ifx\empty\destdir somewhere \fi
  551.                   on the system.^^J%
  552.                   Overwrite it%
  553.                   \ifx\empty\destdir\space if necessary\fi
  554.                   ? [y/n]}%
  555.       \ifx\y  \answer \else
  556.       \ifx\yes\answer \else
  557.                       \Generatefalse\fi\fi\fi
  558.     \closein\inFile
  559.   \fi
  560.   \ifGenerate
  561.   \Name\let{pth@#1}\@pathname
  562.   \@addto\filestogenerate{\@pathname\space}%
  563.   \Name\@fileX{#1\expandafter}%
  564.   \else
  565.     \Msg{Not generating file \@pathname^^J}%
  566.   \expandafter\@gobble
  567.   \fi
  568.   }
  569. \def\@fileX#1#2{%
  570.   \chardef#1=\stream@closed
  571.   \def\curout{#1}%
  572.   \let\curinfiles\empty
  573.   \let\curinnames\empty
  574.   \def\curref{\MetaPrefix ^^J%
  575.               \MetaPrefix\space The original source files were:^^J%
  576.               \MetaPrefix ^^J}%
  577.   \let\from\@from \let\needed\@needed
  578.   #2%
  579.   \let\from\err@from \let\needed\err@needed
  580.   \checkorder
  581.   \Name\@addto{e@\curin}{\noexpand\closeoutput{#1}}%
  582.   \Name\let{pre@\@stripstring#1\expandafter}\currentpreamble
  583.   \Name\let{post@\@stripstring#1\expandafter}\currentpostamble
  584.   \Name\edef{in@\@stripstring#1}{\expandafter\iden\curinnames}
  585.   \Name\edef{ref@\@stripstring#1}{\curref}
  586.   }
  587. \def\checkorder{%
  588.   \expandafter\expandafter\expandafter
  589.   \checkorderX\expandafter\curinfiles
  590.   \expandafter\qStop\inputfiles\qStop
  591.   }
  592. \def\checkorderX(#1)#2\qStop#3\qStop{%
  593.   \def\tmp##1\readsource(#1)##2\qStop{%
  594.     \ifx!##2! \order@error
  595.     \else\ifx!#2!\else
  596.        \checkorderXX##2%
  597.     \fi\fi}%
  598.   \def\checkorderXX##1\readsource(#1)\fi\fi{\fi\fi
  599.     \checkorderX#2\qStop##1\qStop}%
  600.   \tmp#3\readsource(#1)\qStop
  601.   }
  602. \def\order@error#1\fi\fi{\fi
  603.   \errmessage{DOCSTRIP error: Incompatible order of input
  604.               files specified for file
  605.               `\iden{\expandafter\uptospace\curin} \qStop'.^^J
  606.               Read DOCSTRIP documentation for explanation.^^J
  607.               This is a serious problem, I'm exiting}\end
  608.   }
  609. \def\needed#1{\errmessage{\string\needed\space can only be used in
  610.                argument to \string\file}}
  611. \let\err@needed\needed
  612. \def\@needed#1{%
  613.   \edef\reserved@a{#1}%
  614.   \expandafter\@need@d\expandafter{\reserved@a}}
  615. \def\@need@d#1{%
  616.   \@ifpresent{(#1)}\curinfiles
  617.     {\@need@d{#1 }}%
  618.     {\@ifpresent{\readsource(#1)}\inputfiles
  619.        {}{\@addto\inputfiles{\noexpand\readsource(#1)}%
  620.        \Name\let{b@#1}\empty
  621.        \Name\let{o@#1}\empty
  622.        \Name\let{e@#1}\empty}%
  623.      \@addto\curinfiles{(#1)}%
  624.      \def\curin{#1}}%
  625.   }
  626. \def\from#1#2{\errmessage{Command `\string\from' only allowed in
  627.                           argument to `\string\file'}}
  628. \let\err@from\from
  629. \def\@from#1#2{%
  630.   \@addto\curref{\MetaPrefix\space #1 \if>#2>\else
  631.                               \space (with options: `#2')\fi^^J}%
  632.   \needed{#1}%
  633.   \ifx\curinnames\empty
  634.      \Name\@addto{b@\curin}{\noexpand\openoutput\curout}%
  635.   \fi
  636.   \@addto\curinnames{ #1}%
  637.   \Name\@addto{o@\curin}{\noexpand\do\curout{#2}}%
  638.   }
  639. \def\readsource(#1){%
  640.   \immediate\openin\inFile\uptospace#1 \qStop\relax
  641.   \ifeof\inFile
  642.     \errmessage{Cannot find file \uptospace#1 \qStop}%
  643.   \else
  644.     \processedLines\z@
  645.     \commentsRemoved\z@
  646.     \commentsPassed\z@
  647.     \codeLinesPassed\z@
  648.     \let\refusedfiles\empty
  649.     \csname b@#1\endcsname
  650.     \Name\let{b@#1}\refusedfiles
  651.     \Msg{} \def\@msg{Processing file \uptospace#1 \qStop}
  652.     \def\change@msg{%
  653.       \edef\@msg{\@spaces\@spaces\@spaces\space
  654.         \expandafter\tospaces\uptospace#1 \qStop\secapsot}
  655.       \let\change@msg\relax}
  656.     \let\do\showfiles@do
  657.     \let\refusedfiles\empty
  658.     \csname o@#1\endcsname
  659.     \ifx\refusedfiles\empty\else
  660.       \@addto\newinputfiles{\noexpand\readsource(#1)}
  661.     \fi
  662.     \let\do\makeoutlist@do
  663.     \edef\outputfiles{\csname o@#1\endcsname}%
  664.     \let\activefiles\outputfiles
  665.     \Name\let{o@#1}\refusedfiles
  666.     \makeOther\ \makeOther\\\makeOther\$%
  667.     \makeOther\#\makeOther\^\makeOther\^^K%
  668.     \makeOther\_\makeOther\^^A\makeOther\%%
  669.     \makeOther\~\makeOther\{\makeOther\}\makeOther\&%
  670.     \endlinechar-1\relax
  671.     \loop
  672.       \read\inFile to\inLine
  673.       \ifx\inLine\Endinput
  674.         \Msg{File #1 ended by \string\endinput.}%
  675.         \Continuefalse
  676.       \else
  677.        \ifeof\inFile
  678.          \Continuefalse
  679.        \else
  680.          \Continuetrue
  681.          \ifx\inLine\empty
  682.             \advance\emptyLines\@ne
  683.           \else
  684.             \emptyLines\z@
  685.           \fi
  686.           \ifnum \emptyLines<2
  687.             \expandafter\processLine\inLine\endLine
  688.           \else
  689.             \maybeMsg{/}%
  690.           \fi
  691.        \fi
  692.       \fi
  693.     \ifContinue
  694.     \repeat
  695.     \closein\inFile
  696.   \csname e@#1\endcsname
  697.     \Msg{Lines \space processed: \the\processedLines^^J%
  698.          Comments removed: \the\commentsRemoved^^J%
  699.          Comments \space passed: \the\commentsPassed^^J%
  700.          Codelines passed: \the\codeLinesPassed^^J}%
  701.       \global\advance\TotalprocessedLines  by \processedLines
  702.       \global\advance\TotalcommentsRemoved by \commentsRemoved
  703.       \global\advance\TotalcommentsPassed  by \commentsPassed
  704.       \global\advance\TotalcodeLinesPassed by \codeLinesPassed
  705.       \global\advance\NumberOfFiles by \@ne
  706.     \fi}
  707. \def\showfiles@do#1#2{%
  708.   \ifnum#1=\stream@closed
  709.     \@addto\refusedfiles{\noexpand\do#1{#2}}%
  710.   \else
  711.     \Msg{\@msg
  712.          \ifx>#2>\else\space(#2)\fi
  713.          \space -> \@stripstring#1}
  714.     \change@msg
  715.   \csname off@\number#1\endcsname=\z@
  716.   \fi
  717. }
  718. \def\makeoutlist@do#1#2{%
  719.   \ifnum#1=\stream@closed\else
  720.     \noexpand\do#1{#2}\csname off@\number#1\endcsname
  721.   \fi}
  722. \def\openoutput#1{%
  723.   \if 1\ifnum\@maxfiles=\z@ 0\fi
  724.        \ifnum\@maxoutfiles=\z@ 0\fi1%
  725.     \advance\@maxfiles\m@ne
  726.     \advance\@maxoutfiles\m@ne
  727.     \StreamOpen#1%
  728.     \WritePreamble#1%
  729.   \else
  730.      \@addto\refusedfiles{\noexpand\openoutput#1}%
  731.   \fi
  732.   }
  733. \def\closeoutput#1{%
  734.   \ifnum#1=\stream@closed\else
  735.     \WritePostamble#1%
  736.     \StreamClose#1%
  737.     \advance\@maxfiles\@ne
  738.     \advance\@maxoutfiles\@ne
  739.   \fi}
  740. \def\ds@heading{%
  741.   \MetaPrefix ^^J%
  742.   \MetaPrefix\space This is file `\outFileName',^^J%
  743.   \MetaPrefix\space  generated with the docstrip utility.^^J%
  744.   }
  745. \def\AddGenerationDate{%
  746.   \def\ds@heading{%
  747.     \MetaPrefix ^^J%
  748.     \MetaPrefix\space This is file `\outFileName', generated %
  749.            on <\the\year/\the\month/\the\day> ^^J%
  750.     \MetaPrefix\space with the docstrip utility (\fileversion).^^J%
  751.  }}
  752. \let\inFileName\relax
  753. \let\outFileName\relax
  754. \let\ReferenceLines\relax
  755. \def\declarepreamble{\begingroup
  756. \catcode`\^^M=13 \catcode`\ =12 %
  757. \declarepreambleX}
  758. {\catcode`\^^M=13 %
  759. \gdef\declarepreambleX#1#2
  760. \endpreamble{\endgroup%
  761.   \def^^M{^^J\MetaPrefix\space}%
  762.   \edef#1{\ds@heading%
  763.           \ReferenceLines%
  764.           \MetaPrefix\space\checkeoln#2\empty}}%
  765. \gdef\checkeoln#1{\ifx^^M#1\else\expandafter#1\fi}%
  766. }
  767. \def\declarepostamble{\begingroup
  768. \catcode`\ =12 \catcode`\^^M=13
  769. \declarepostambleX}
  770. {\catcode`\^^M=13 %
  771. \gdef\declarepostambleX#1#2
  772. \endpostamble{\endgroup%
  773.   \def^^M{^^J\MetaPrefix\space}%
  774.   \edef#1{\MetaPrefix\space\checkeoln#2\empty^^J%
  775.           \MetaPrefix ^^J%
  776.           \MetaPrefix\space End of file `\outFileName'.%
  777.   }}%
  778. }
  779. \def\usepreamble#1{\def\currentpreamble{#1}}
  780. \def\usepostamble#1{\def\currentpostamble{#1}}
  781. \def\preamble{\usepreamble\defaultpreamble
  782.   \declarepreamble\defaultpreamble}
  783. \def\postamble{\usepostamble\defaultpostamble
  784.   \declarepostamble\defaultpostamble}
  785. \declarepreamble\org@preamble
  786.  
  787. IMPORTANT NOTICE:
  788.  
  789. For the copyright see the source file.
  790.  
  791. You are *not* allowed to modify this file.
  792.  
  793. You are *not* allowed to distribute this file.
  794. For distribution of the original source see the terms
  795. for copying and modification in the file \inFileName.
  796.  
  797. \endpreamble
  798. \edef\org@postamble{\string\endinput^^J%
  799.   \MetaPrefix ^^J%
  800.   \MetaPrefix\space End of file `\outFileName'.%
  801.   }
  802.  
  803. \let\defaultpreamble\org@preamble
  804. \let\defaultpostamble\org@postamble
  805. \usepreamble\defaultpreamble
  806. \usepostamble\defaultpostamble
  807. \def\WritePreamble#1{%
  808.     \edef\outFileName{\@stripstring#1}%
  809.     \StreamPut#1{\csname pre@\@stripstring#1\endcsname}}
  810. \def\WritePostamble#1{%
  811.     \edef\outFileName{\@stripstring#1}%
  812.     \StreamPut#1{\csname post@\@stripstring#1\endcsname}}
  813. \def\usedir#1{\edef\destdir{\WriteToDir}}
  814. \def\showdirectory#1{\WriteToDir}
  815. \def\BaseDirectory#1{%
  816.   \@setwritetodir
  817.   \let\usedir\alt@usedir
  818.   \let\showdirectory\showalt@directory
  819.   \edef\basedir{#1\dirsep}}
  820. \def\convsep#1/#2\qStop{%
  821.   #1\ifx\qStop#2\qStop \pesvnoc\fi\convsep\dirsep#2\qStop}
  822. \def\pesvnoc#1\qStop{\fi}
  823. \def\alt@usedir#1{%
  824.   \Name\ifx{dir@#1}\relax
  825.     \undefined@directory{#1}%
  826.   \else
  827.     \edef\destdir{\csname dir@#1\endcsname}%
  828.   \fi}
  829. \def\showalt@directory#1{%
  830.   \Name\ifx{dir@#1}\relax
  831.     \showundef@directory{#1}%
  832.   \else\csname dir@#1\endcsname\fi}
  833. \def\undefined@directory#1{%
  834.   \errhelp{docstrip.cfg should specify a target directory for^^J%
  835.    #1 using \DeclareDir or \UseTDS.}%
  836.   \errmessage{You haven't defined output directory for `#1'.^^J%
  837.             Subsequent files will be written to the current directory.}%
  838.   \let\destdir\WriteToDir
  839.   }
  840. \def\showundef@directory#1{UNDEFINED (label is #1)}
  841. \def\undefined@TDSdirectory#1{%
  842.   \edef\destdir{%
  843.     \basedir\convsep#1/\qStop
  844.   }}
  845. \def\showundef@TDSdirectory#1{\basedir\convsep#1/\qStop}
  846. \def\UseTDS{%
  847.   \@setwritetodir
  848.   \let\undefined@directory\undefined@TDSdirectory
  849.   \let\showundef@directory\showundef@TDSdirectory
  850.   }
  851. \def\DeclareDir{\@ifnextchar*{\DeclareDirX}{\DeclareDirX\basedir*}}
  852. \def\DeclareDirX#1*#2#3{%
  853.   \@setwritetodir
  854.   \Name\edef{dir@#2}{#1#3}}
  855. \def\generateFile#1#2#3{{%
  856.   \ifx t#2\askforoverwritetrue
  857.   \else\askforoverwritefalse\fi
  858.   \generate{\file{#1}{#3}}%
  859.   }}
  860. \def\include#1{\def\Options{#1}}
  861. \def\processFile#1#2#3#4{%
  862.   \generateFile{#1.#3}{#4}{\from{#1.#2}{\Options}}}
  863. \def\processfile{\Msg{%
  864.     ^^Jplease use \string\processFile\space instead of
  865.        \string\processfile!^^J}%
  866.     \processFile}
  867. \def\generatefile{\Msg{%
  868.     ^^Jplease use \string\generateFile\space instead of
  869.       \string\generatefile!^^J}%
  870.     \generateFile}
  871. \newcount\@maxfiles
  872. \def\maxfiles#1{%
  873.   \@maxfiles#1\relax
  874.   \ifnum\@maxfiles<4
  875.     \errhelp{I'm not a magician.  I need at least four^^J%
  876.              streams to be able to work properly, but^^J%
  877.              you've only let me use \the\@maxfiles.}%
  878.     \errmessage{\noexpand\maxfiles limit is too strict.}%
  879.     \@maxfiles4
  880.   \fi
  881. }
  882. \maxfiles{1972} % year of my birth (MW)
  883. \newcount\@maxoutfiles
  884. \def\maxoutfiles#1{%
  885.   \@maxoutfiles=#1\relax
  886.   \ifnum\@maxoutfiles<1
  887.     \@maxoutfiles1
  888.     \errhelp{I'm not a magician.  I need at least one output^^J%
  889.              stream to be able to do anything useful at all.^^J%
  890.              Please be reasonable.}%
  891.     \errmessage{\noexpand\maxoutfiles limit is insane}%
  892.   \fi
  893. }
  894. \maxoutfiles{16}
  895. \def\checkfilelimit{%
  896.   \advance\@maxfiles\m@ne
  897.   \ifnum\@maxfiles<2 %
  898.     \errhelp{There aren't enough streams left to do any unpacking.^^J%
  899.              I can't do anything about this, so complain at the^^J%
  900.              person who made such a complicated installation.}%
  901.     \errmessage{Too few streams left.}%
  902.     \end
  903.   \fi
  904. }
  905. \def\strip@meaning#1>{}
  906. \def\processbatchFile{%
  907.   \checkfilelimit
  908.   \let\next\relax
  909.   \openin\inputcheck \batchfile\relax
  910.   \ifeof\inputcheck
  911.     \ifDefault
  912.     \else
  913.       \errhelp
  914.         {A batchfile specified in \batchinput could not be found.}%
  915.       \errmessage{^^J%
  916.            **************************************************^^J%
  917.            * Could not find your \string\batchfile=\batchfile.^^J%
  918.            **************************************************}%
  919.     \fi
  920.   \else
  921.     \ifDefault
  922.       \Msg{**************************************************^^J%
  923.            * Batchfile \DefaultbatchFile\space found Use it? (y/n)?}%
  924.       \Ask\answer{%
  925.              **************************************************}%
  926.     \else
  927.       \let\answer\y
  928.     \fi
  929.     \ifx\answer\y
  930.       \closein\inputcheck
  931.       \def\next{\@@input\batchfile\relax}%
  932.     \fi
  933.   \fi
  934.   \next}
  935. \def\ReportTotals{%
  936.   \ifnum\NumberOfFiles>\@ne
  937.     \Msg{Overall statistics:^^J%
  938.          Files \space processed: \the\NumberOfFiles^^J%
  939.          Lines \space processed: \the\TotalprocessedLines^^J%
  940.          Comments removed: \the\TotalcommentsRemoved^^J%
  941.          Comments \space passed: \the\TotalcommentsPassed^^J%
  942.          Codelines passed: \the\TotalcodeLinesPassed}%
  943.   \fi}
  944. \def\SetFileNames{%
  945.     \edef\sourceFileName{\MainFileName.\infileext}%
  946.     \edef\destFileName{\MainFileName.\outfileext}}
  947. \def\CheckFileNames{%
  948.     \ifx\sourceFileName\destFileName
  949.       \Msg{^^J%
  950.      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
  951.      ! It is not possible to read from and write to the same file !^^J%
  952.      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
  953.       \Continuefalse
  954.     \else
  955.       \Continuetrue
  956.       \immediate\openin\inFile \sourceFileName\relax
  957.       \ifeof\inFile
  958.         \Msg{^^J%
  959.               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
  960.               ! Your input file `\sourceFileName' was not found !^^J%
  961.               !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
  962.         \Continuefalse
  963.       \else
  964.         \immediate\closein\inFile
  965.         \immediate\openin\inFile\destdir \destFileName\relax
  966.         \ifeof\inFile
  967.           \Continuetrue
  968.         \else
  969.           \Continuefalse
  970.           \Ask\answer{File \destdir\destFileName\space already
  971.                       exists
  972.                       \ifx\empty\destdir somewhere \fi
  973.                       on the system.^^J%
  974.                       Overwrite it%
  975.                       \ifx\empty\destdir\space if necessary\fi
  976.                       ? [y/n]}%
  977.           \ifx\y  \answer \Continuetrue \else
  978.           \ifx\yes\answer \Continuetrue \else
  979.           \fi\fi
  980.         \fi
  981.       \fi
  982.     \fi
  983.     \closein\inFile}
  984. \def\interactive{%
  985.   \whileswitch\ifMoreFiles\fi%
  986.    {\begingroup
  987.       \AskQuestions
  988.       \forlist\MainFileName:=\filelist
  989.       \do
  990.         \SetFileNames
  991.         \CheckFileNames
  992.         \ifContinue
  993.         \generateFile{\destFileName}{f}%
  994.                      {\from{\sourceFileName}{\Options}}
  995.         \fi%
  996.       \od
  997.     \endgroup
  998.     \Ask\answer{More files to process (y/n)?}%
  999.     \ifx\y  \answer\MoreFilestrue \else
  1000.     \ifx\yes\answer\MoreFilestrue \else
  1001.                    \MoreFilesfalse\fi\fi
  1002.    }}
  1003. \def\AskQuestions{%
  1004.     \Msg{^^J%
  1005.          ****************************************************}%
  1006.     \Ask\infileext{%
  1007.          * First type the extension of your input file(s): \space  *}%
  1008.     \Msg{****************************************************^^J^^J%
  1009.          ****************************************************}%
  1010.     \Ask\outfileext{%
  1011.          * Now type the extension of your output file(s) \space: *}%
  1012.     \Msg{****************************************************^^J^^J%
  1013.          ****************************************************}%
  1014.     \Ask\Options{%
  1015.        * Now type the name(s) of option(s) to include \space\space: *}%
  1016.     \Msg{****************************************************^^J^^J%
  1017.          ****************************************************^^J%
  1018.        * Finally give the list of input file(s) without \space\space*}%
  1019.     \Ask\filelist{%
  1020.          * extension seperated by commas if necessary %
  1021.                                   \space\space\space\space: *}%
  1022.     \Msg{****************************************************^^J}}%
  1023. \Msg{Utility: `docstrip' \fileversion\space <\filedate>^^J%
  1024.      English documentation \space\space\space <\docdate>}%
  1025. \Msg{^^J%
  1026.      **********************************************************^^J%
  1027.      * This program converts documented macro-files into fast *^^J%
  1028.      * loadable files by stripping off (nearly) all comments! *^^J%
  1029.      **********************************************************^^J}%
  1030. \def\@setwritetodir{%
  1031.   \let\setwritetodir\relax
  1032.   \ifx\WriteToDir\@undefined
  1033.     \ifx\@currdir\@undefined
  1034.       \def\WriteToDir{}%
  1035.     \else
  1036.       \let\WriteToDir\@currdir
  1037.     \fi
  1038.   \fi
  1039.   \let\destdir\WriteToDir
  1040.   \def\tmp{[]}%
  1041.   \ifx\tmp\WriteToDir
  1042.     \ifx\dirsep\@undefined
  1043.       \def\dirsep{.}%
  1044.     \fi
  1045.     \ifx\makepathname\@undefined
  1046.       \def\makepathname##1{%
  1047.         \edef\@pathname{\ifx\WriteToDir\destdir
  1048.           \WriteToDir\else[\destdir]\fi##1}}%
  1049.     \fi
  1050.   \fi
  1051.   \ifx\dirsep\@undefined
  1052.     \def\dirsep{/}%
  1053.     \def\tmp{:}%
  1054.     \ifx\tmp\WriteToDir
  1055.       \def\dirsep{:}%
  1056.     \fi
  1057.   \fi
  1058.   \ifx\makepathname\@undefined
  1059.     \def\makepathname##1{%
  1060.       \edef\@pathname{\destdir\ifx\empty\destdir\else
  1061.            \ifx\WriteToDir\destdir\else\dirsep\fi\fi##1}}%
  1062.   \fi}
  1063. \immediate\openin\inputcheck=docstrip.cfg\relax
  1064. \ifeof\inputcheck
  1065.   \Msg{%
  1066.      ********************************************************^^J%
  1067.      * No Configuration file found, using default settings. *^^J%
  1068.      ********************************************************^^J}%
  1069. \else
  1070.   \Msg{%
  1071.      ******************************************^^J%
  1072.      * Using Configuration file docstrip.cfg. *^^J%
  1073.      ******************************************^^J}%
  1074.   \closein\inputcheck
  1075.   \afterfi{\@@input docstrip.cfg\relax}
  1076. \fi
  1077. \@setwritetodir
  1078. \def\process@first@batchfile{%
  1079.   \processbatchFile
  1080.   \ifnum\NumberOfFiles=\z@
  1081.     \interactive
  1082.   \fi
  1083.   \endbatchfile}
  1084. \def\endbatchfile{%
  1085.   \iftopbatchfile
  1086.     \ReportTotals
  1087.     \expandafter\end
  1088.   \else
  1089.     \endinput
  1090.   \fi}
  1091. \edef\@jobname{\lowercase{\def\noexpand\@jobname{\jobname}}}%
  1092. \@jobname
  1093. \def\@docstrip{docstrip}%
  1094. \edef\@docstrip{\expandafter\strip@meaning\meaning\@docstrip}
  1095. \Defaultfalse
  1096. \ifx\undefined\batchfile
  1097.   \ifx\@jobname\@docstrip
  1098.     \let\batchfile\DefaultbatchFile
  1099.     \Defaulttrue
  1100.   \else
  1101.     \let\process@first@batchfile\relax
  1102.   \fi
  1103. \fi
  1104. \process@first@batchfile
  1105. \endinput
  1106. %%
  1107. %% End of file `docstrip.tex'.
  1108.